<?php
/**
 * Description:水电度数
 * User: wuhao
 * Date: 2017-06-09
 * Time: 11:47
 */
namespace app\backend\model;

use think\Model;

class WaterPower extends Model
{
    private $_waterPower = 'z_water_power';
    public function __construct()
    {
        parent::__construct();
    }

    public function addList($data)
    {
        if (!$data) {
            return false;
        }
        return $this->table($this->_waterPower)->insertAll($data);
    }

    public function getInfo($ordernum, $begin, $end, $feeType)
    {
        if (!$ordernum || !$begin || !$end || !$feeType) {
            return false;
        }
        $where = [
            'ordernum' => $ordernum,
            'begin_cycle' => $begin,
            'end_cycle' => $end,
            'fee_type' => $feeType
        ];
        $res = $this->table($this->_waterPower)->field('id, last, this, actual')->where($where)->find();
        return $res ?: [];
    }
}